<?php
	namespace app\controllers\test_study;
	use yii\web\Controller;
	//use YII;
	class RequestController extends Controller{
		public function actionIndex(){
			//echo "Hello World";
			$request = \YII::$app->request;
			echo $request->get('id',20);
								  
			echo "<br>";
			echo $request->post('id',30);
			if($request->isGet){
				echo "this is get method";
			}
		}
		public function actionRequest(){
			//判断是不是ajax请求
			var_dump(\YII::$app->request->isAjax);
			//判断是不是post请求
			var_dump(\YII::$app->request->isPost);
			//获取用户的浏览器
			var_dump(\YII::$app->request->userAgent);
			//获取用户ip
			var_dump(\YII::$app->request->userIp);
			//读取get
			var_dump(\YII::$app->request->get());
			var_dump(\YII::$app->request->post('id'));
			
		}
	}
?>